#include <iostream>

int factorial_recursion(int);
int factorial_interactive(int);

int main()
{
	int number = 1;

	std::cout << "Enter number: ";
	do
	{
		std::cin >> number;
	}
	while(number < 0);

	std::cout << "\nRecursion method: " << factorial_recursion(number) << std::endl;
	std::cout << "Interactive method: " << factorial_interactive(number) << std::endl;
	std::cout << std::endl;
	
	return 0;
}

// functions

int factorial_recursion(int number)
{
	if(1 == number)
	{
		return 1;
	}
	return number * factorial_recursion(number - 1);
}

int factorial_interactive(int number)
{
	int result = 1;

	for(int i = 1; i <= number; ++i)
		result *= i;

	return result;
}

